import { createStore, applyMiddleware } from 'redux'
// 引入汇总所有的reducer
import reducer from '../store/reducers'
//引入redux-thunk，用于支持异步action
import thunk from 'redux-thunk'
//引入redux-devtools-extension,用于redux调试工具
import { composeWithDevTools } from 'redux-devtools-extension'

const store = createStore(reducer, composeWithDevTools(applyMiddleware(thunk)))

/* // TS支持useSelector泛型
// const count = useSelector < RootState > ((state) => state.count) */
// export type RootState = ReturnType<typeof store.getState>

export default store
